import request from '@/utils/request';
import URLS from './APIUrlDefine';
import { CURRENT_TOKEN } from '@/components/Authorized/renderAuthorize';

/**
 * 获取平台列表
 */
 export async function GetClientList(data: any) {
    return request(`${URLS.GET_CLIENT_LIST}/${data.page}/${data.count}`, {
      method: 'GET',
      headers: {
        Authorization: `Bearer ${CURRENT_TOKEN}`,
      },
    }).then((res)=>{
        const data=res.data;
      const result={
        data:data.records,
        total:data.total,
        success:true,
        pageSize:data.size,
        current:parseInt(`${data.current}`,10)||1,
      };
      return Promise.resolve(result);
    })
    ;
  }

  /**
  *新建平台
  */
  export async function CreateNewClient(data: any) {
    console.log(JSON.stringify(data))
    return request(URLS.CREAT_NEW_CLIENT, {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${CURRENT_TOKEN}`,
        'content-type': 'application/json',
      },
      params: data,
    });
  }
